package com.fr.report.cellElement;

import com.fr.base.BaseUtils;
import com.fr.base.ColumnRow;
import com.fr.base.XMLable;
import com.fr.base.xml.XMLPrintWriter;
import com.fr.base.xml.XMLableReader;

public class CellExpandAttr
  implements XMLable
{
  public static final byte Both_EXTENDABLE = 0;
  public static final byte Vertical_EXTENDABLE = 1;
  public static final byte Horizontal_EXTENDABLE = 2;
  public static final byte None_EXTENDABLE = 3;
  private byte direction = 2;
  private byte extendable = 0;
  private boolean extendIsCover = false;
  private int extendMultipleNumber = -1;
  private boolean leftParentDefault = true;
  private boolean upParentDefault = true;
  private ColumnRow leftParentColumnRow = null;
  private ColumnRow upParentColumnRow = null;

  public byte getDirection()
  {
    return this.direction;
  }

  public void setDirection(byte paramByte)
  {
    this.direction = paramByte;
  }

  public byte getExtendable()
  {
    return this.extendable;
  }

  public void setExtendable(byte paramByte)
  {
    this.extendable = paramByte;
  }

  public boolean getExtendIsCover()
  {
    return this.extendIsCover;
  }

  public void setExtendIsCover(boolean paramBoolean)
  {
    this.extendIsCover = paramBoolean;
  }

  public int getMultipleNumber()
  {
    return this.extendMultipleNumber;
  }

  public void setMultipleNumber(int paramInt)
  {
    this.extendMultipleNumber = paramInt;
  }

  public ColumnRow getLeftParentColumnRow()
  {
    return this.leftParentColumnRow;
  }

  public void setLeftParentColumnRow(ColumnRow paramColumnRow)
  {
    this.leftParentColumnRow = paramColumnRow;
  }

  public ColumnRow getUpParentColumnRow()
  {
    return this.upParentColumnRow;
  }

  public void setUpParentColumnRow(ColumnRow paramColumnRow)
  {
    this.upParentColumnRow = paramColumnRow;
  }

  public boolean isLeftParentDefault()
  {
    return this.leftParentDefault;
  }

  public void setLeftParentDefault(boolean paramBoolean)
  {
    this.leftParentDefault = paramBoolean;
  }

  public boolean isUpParentDefault()
  {
    return this.upParentDefault;
  }

  public void setUpParentDefault(boolean paramBoolean)
  {
    this.upParentDefault = paramBoolean;
  }

  public String toString()
  {
    return "UP:" + this.upParentColumnRow + ';' + "LEFT:" + this.leftParentColumnRow;
  }

  public void readXML(XMLableReader paramXMLableReader)
  {
    if (paramXMLableReader.isAttr())
    {
      String str;
      if ((str = paramXMLableReader.getAttr("dir")) != null)
        setDirection((byte)Integer.parseInt(str));
      if ((str = paramXMLableReader.getAttr("extendable")) != null)
        setExtendable(Byte.parseByte(str));
      if ((str = paramXMLableReader.getAttr("isCover")) != null)
        setExtendIsCover(str.equalsIgnoreCase("true"));
      if ((str = paramXMLableReader.getAttr("multiNumber")) != null)
        setMultipleNumber(Integer.parseInt(str));
      if ((str = paramXMLableReader.getAttr("leftParentDefault")) != null)
        setLeftParentDefault(str.equalsIgnoreCase("true"));
      if ((str = paramXMLableReader.getAttr("left")) != null)
      {
        this.leftParentColumnRow = BaseUtils.convertCellStringToColumnRow(str);
        this.leftParentDefault = false;
      }
      if ((str = paramXMLableReader.getAttr("upParentDefault")) != null)
        setUpParentDefault(str.equalsIgnoreCase("true"));
      if ((str = paramXMLableReader.getAttr("up")) != null)
      {
        this.upParentColumnRow = BaseUtils.convertCellStringToColumnRow(str);
        this.upParentDefault = false;
      }
    }
  }

  public void writeXML(XMLPrintWriter paramXMLPrintWriter)
  {
    paramXMLPrintWriter.startTAG("Expand");
    if (this.direction != 2)
      paramXMLPrintWriter.attr("dir", this.direction);
    if (this.extendable != 0)
      paramXMLPrintWriter.attr("extendable", this.extendable);
    if (this.extendIsCover)
      paramXMLPrintWriter.attr("isCover", this.extendIsCover);
    if (this.extendMultipleNumber != -1)
      paramXMLPrintWriter.attr("multiNumber", this.extendMultipleNumber);
    if (!(isLeftParentDefault()))
    {
      paramXMLPrintWriter.attr("leftParentDefault", "false");
      if (this.leftParentColumnRow != null)
        paramXMLPrintWriter.attr("left", this.leftParentColumnRow.toString());
    }
    if (!(isUpParentDefault()))
    {
      paramXMLPrintWriter.attr("upParentDefault", "false");
      if (this.upParentColumnRow != null)
        paramXMLPrintWriter.attr("up", this.upParentColumnRow.toString());
    }
    paramXMLPrintWriter.end();
  }

  public Object clone()
    throws CloneNotSupportedException
  {
    return super.clone();
  }
}